<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>智慧党建系统后台</title>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" href="__PUBLIC__/css/admin.css">
    <link rel="stylesheet" href="__PUBLIC__/plugins/layui/css/layui.css">
    <script src="__PUBLIC__/js/jquery-1.11.3.min.js" type="text/javascript"></script>
    <script src="__PUBLIC__/plugins/layui/layui.js" type="text/javascript"></script>
    <style>
        #login {
            background: url('/image/admin_loginbg.png') center -150px no-repeat;
        }
        .login {
            margin-top: 100px!important;
        }
        .login h2 {
            margin-bottom: 10px;
        }
        .bottom-text {
            position: absolute;
            bottom: 10px;
            width: 100%;
            display: block;
            text-align: center;
        }
    </style>
</head>
<body id="login">
<div class="login">
    {if !empty(getConfig('admin_login_logo_img'))}
    <p style="text-align: center">
        <img src="{:getConfig('admin_login_logo_img')??'/install/static/images/logo.png'}"
             style="margin-bottom: 20px; width: 250px; height: auto;vertical-align: middle;">
    </p>
    {else}
    <h2>71CMS创先云智慧党建系统</h2>
    {/if}
    <p style="text-align: center;margin-bottom: 20px;font-size: 22px;font-weight: bold;">党组织管理端登录</p>
    <form class="layui-form">
        <div class="layui-form-item">
            <input type="text" name="username" placeholder="请输入账号" required lay-verify="required" autocomplete="off"
                   class="layui-input">
        </div>
        <div class="layui-form-item">
            <input type="password" name="password" placeholder="请输入密码" required lay-verify="required" autocomplete="off"
                   class="layui-input">
        </div>
        {if condition="$yzm eq 1"}
        <div class="layui-form-item">
            <input style="width:100px;float:left;margin-right: 10px;" type="text" name="verify" placeholder="验证码"
                   required lay-verify="required" autocomplete="off" class="layui-input">
            <img id="captcha" src="{:url('login/captcha')}" onclick="this.src='{:url('login/captcha')}?'+Math.random();"
                 width="150" style="float:left; cursor:pointer;" alt="captcha"/>
        </div>
        {/if}
        <div class="layui-form-item">
            <button style="padding: 0 102px;" class="layui-btn" lay-submit="" lay-filter="login_index">立即登录</button>
        </div>
    </form>
</div>
<div class="bottom-text">
    <a class="beian" href="https://www.71cms.net" target="_blank"> 71CMS创先云智慧党建系统 </a>
    <a class="beian" href="https://beian.miit.gov.cn" target="_blank"> </a>
</div>
<script type="text/javascript">
    if (top.location != self.location) {
        top.location = self.location;
    }
    layui.use('form', function () {
        var form = layui.form
            , jq = layui.jquery;

        form.on('submit(login_index)', function (data) {
            loading = layer.load(2, {
                shade: [0.2, '#000']
            });
            var param = data.field;
            jq.post('{:url("login/login")}', param, function (data) {
                if (data.code == 1) {
                    layer.close(loading);
                    layer.msg(data.msg, {icon: 1, time: 1000}, function () {
                        window.location.replace('{:url("index/index")}')
                    });
                } else {
                    layer.close(loading);
                    layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
                    $('#captcha').attr('src', "{:url('login/captcha')}?" + Math.random());
                }
            }).fail(function () {
                layer.close(loading);
                layer.msg('服务器连接失败，请稍后重试！', {icon: 2, anim: 6, time: 3000});
            });
            return false;
        });
    })
</script>
</body>
</html>